package com.njwb.day15.zqzb.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class JdbcTest01 {
    public static void main(String[] args) {
        //构建连接对象
        Connection connection= null ;
        try {
            //加载驱动
            Class.forName("com.mysql.cj.jdbc.Driver");
            /*
            * url:jdbc:mysql://ip:port/databaseName
            * */
            connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/mytest","root","root");
            System.out.println(connection);


        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }

    }
}
